package com.merugu.school.util;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * User: raveendramerugu
 * Date: 18/06/2011
 * Time: 16:57
 */
public class GetHostName {


    public static void main(String[] args) {
        try {
            InetAddress addr = InetAddress.getLocalHost();
             String hostname = addr.getHostName();
            System.out.println("The Host Name is " + hostname);

            System.out.println("The IP address is " + addr.getHostAddress());
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }

    }
}
